<html>
<head>
<h1>Create New</h1>
</head>

<body>
<form action="addstudent.php" method="GET">
ID: <input type='text' name = 'id' /> <br/>
Name: <input type='text' name = 'name' /> <br/>
<input type='submit' name = 'create' value='Create'/>
</form>
</body>
<?php
	require "config.php";
	error_reporting(0);
	$name = $_GET['name'];
	$id = $_GET['id'];
	
	$con = mysql_connect("localhost",$db_user ,$db_pass);

	// if an error was encountered, the script exits with an error message
	if (!$con){
		die('Could not connect: ' . mysql_error());
    }
	//after successfully connecting with the database server, select the database with which you want to communicate
	mysql_select_db($db_name, $con);
	
	$sql_add = "INSERT INTO student (Name,ID) VALUES ('$name', '$id');";
	$result1 = mysql_query($sql_add);
	mysql_close($con);
?>
<br />
<a href="student.php">Home</a>
</html>
